﻿using System.ComponentModel.Composition;
using System.Web.Http;
using CafeOnline.MvcFramework.Interfaces;

namespace CafeOnline.Models.Routes {
    [Export(typeof(IWebApiRouteRegistrar)), ExportMetadata("Order", 100)]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public class DefaultWebApiRouteRegistrar : IWebApiRouteRegistrar {
        //public void RegisterIgnoreRoutes(System.Web.Http.HttpConfiguration routes) {
        //    throw new NotImplementedException();
        //}

        public void RegisterRoutes(HttpConfiguration config) {
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }
    }
}